clippy run
authorleonardo.yvens <leoyvens@gmail.com>
Sat, 12 Dec 2015 18:19:11 +0000 (16:19 -0200)
committerleonardo.yvens <leoyvens@gmail.com>
Mon, 14 Dec 2015 19:03:09 +0000 (17:03 -0200)
src/bin/cargo.rs
src/bin/doc.rs
src/bin/git_checkout.rs
src/bin/read_manifest.rs
src/bin/rustdoc.rs
tests/support/paths.rs

index d3ac5f71a20f503fcf620f5c9a4d16b881298d23..cd4e7204aabcaeafe6c671776487a1f4749510a6 100644 (file)
@@ -131,10 +131,8 @@ fn execute(flags: Flags, config: &Config) -> CliResult<Option<()>> {
 
         // For `cargo help foo`, print out the usage message for the specified
         // subcommand by executing the command with the `-h` flag.
-        "help" => {
-            vec!["cargo".to_string(), flags.arg_args[0].clone(),
-                 "-h".to_string()]
-        }
+        "help" => vec!["cargo".to_string(), flags.arg_args[0].clone(),
+                       "-h".to_string()],
 
         // For all other invocations, we're of the form `cargo foo args...`. We
         // use the exact environment arguments to preserve tokens like `--` for
@@ -168,7 +166,7 @@ fn find_closest(config: &Config, cmd: &str) -> Option<String> {
                                   .filter(|&(d, _)| d < 4)
                                   .collect::<Vec<_>>();
     filtered.sort_by(|a, b| a.0.cmp(&b.0));
-    filtered.get(0).map(|slot| slot.1.to_string())
+    filtered.get(0).map(|slot| slot.1.clone())
 }
 
 fn execute_subcommand(config: &Config,
@@ -245,7 +243,7 @@ fn search_directories(config: &Config) -> Vec<PathBuf> {
     if let Some(val) = env::var_os("PATH") {
         dirs.extend(env::split_paths(&val));
     }
-    return dirs
+    dirs
 }
 
 fn init_git_transports(config: &Config) {
index 17f2734512f0ddc262e57deca74b1c856407fb1d..f75ac83313bd1ef402245a04e12e033956f0d2d6 100644 (file)
@@ -54,7 +54,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
 
     let root = try!(find_root_manifest_for_wd(options.flag_manifest_path, config.cwd()));
 
-    let mut doc_opts = ops::DocOptions {
+    let doc_opts = ops::DocOptions {
         open_result: options.flag_open,
         compile_opts: ops::CompileOptions {
             config: config,
@@ -74,10 +74,9 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
         },
     };
 
-    try!(ops::doc(&root, &mut doc_opts).map_err(|err| {
+    try!(ops::doc(&root, &doc_opts).map_err(|err| {
         CliError::from_boxed(err, 101)
     }));
 
     Ok(None)
 }
-
index ff4d5f4c46cbb27a74cdfa3bc97c7397415870c5..42b6562af1e1cf34dc6e78cd3cacb73123c43fc5 100644 (file)
@@ -34,7 +34,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
                    })
                    .map_err(|e| CliError::from_boxed(e, 1)));
 
-    let reference = GitReference::Branch(reference.to_string());
+    let reference = GitReference::Branch(reference.clone());
     let source_id = SourceId::for_git(&url, reference);
 
     let mut source = GitSource::new(&source_id, config);
index b25eedb0e5d76fe4a07735b2e6b5127a6fedb003..8fa60b6462f4af1b4749c63f297c003b14fbf4a3 100644 (file)
@@ -38,6 +38,6 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<Package>>
     try!(source.update().map_err(|err| CliError::new(err.description(), 1)));
 
     source.root_package()
-          .map(|pkg| Some(pkg))
+          .map(Some)
           .map_err(|err| CliError::from_boxed(err, 1))
 }
index 5a33cb120289d3d59bce364a5f9df1eddf539a48..01a8307c47fb08effe12d9642bf26a98ea15ed61 100644 (file)
@@ -68,7 +68,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
     let root = try!(find_root_manifest_for_wd(options.flag_manifest_path,
                                               config.cwd()));
 
-    let mut doc_opts = ops::DocOptions {
+    let doc_opts = ops::DocOptions {
         open_result: options.flag_open,
         compile_opts: ops::CompileOptions {
             config: config,
@@ -90,8 +90,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
         },
     };
 
-    try!(ops::doc(&root, &mut doc_opts));
+    try!(ops::doc(&root, &doc_opts));
 
     Ok(None)
 }
-
index 57f59d712ef50fae2b1c3fb0991f4d1a0aff0db0..2a25d93b1f3b49ae725c0b2ef75e94073d15acfb 100644 (file)
@@ -1,6 +1,5 @@
 use std::env;
 use std::fs;
-use std::io::prelude::*;
 use std::io::{self, ErrorKind};
 use std::path::{Path, PathBuf};
 use std::sync::{Once, ONCE_INIT};